<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .start{
            padding: 4px;
            font-size: 30px;
        }
        .start.active {
            color: orange;
        }

        /* .source {
            font-size: 3.6vw;
            line-height: 3.8vw;
            padding-left: 1vw;
        } */
    </style>
</head>

<body>
   
    <div id="app">
            <my-start :source="source" @fu="fushijian"></my-start>

    </div>
    <script type="text/x-template" id="mystart">
        <div class="all">
            <span class="start" v-for="c in 5" :class="{active:Math.ceil(source)>=c}" @click=pinfen(c)>★</span>
            <span class="source">{{(source*2).toFixed(1)}}</span>
        </div>
    </script>
    <script type="module">
        const MyStart={
            template:'#mystart',
            props:["source"],
            emits:["fu"],
           
            methods:{
                  pinfen(c) {
             
                    this.$emit("fu",c)


                }
            }
        }


        //父组件
        import { createApp } from "../assets/vue3/vue.esm-browser.js";
        createApp({
            data() {
                return {
                    source: 3
                }
            },
            components:{
               MyStart 
            },
            methods:{
              fushijian(e){
                this.source=e
              }
            }
        }).mount("#app");
    </script>
</body>

</html>